//
//  Frame+.swift
//  SwiftuiZsa
//
//  Created by hccc on 2023/7/24.
//

import Foundation
import UIKit

public func MakeSize(_ width: CGFloat, _ height: CGFloat) -> CGSize {
    return CGSize(width: width, height: height)
}

public func MakeRect(_ x: CGFloat, _ y: CGFloat, _ width: CGFloat, _ height: CGFloat) -> CGRect {
    return CGRect(x: x, y: y, width: width, height: height)
}

public func MakePoint(_ x: CGFloat, _ y: CGFloat) -> CGPoint {
    return CGPoint(x: x, y: y)
}

public func MakeEdge(t top: CGFloat, l left: CGFloat, b bottom: CGFloat, r right: CGFloat) -> UIEdgeInsets {
    return UIEdgeInsets(top: top, left: left, bottom: bottom, right: right)
}

public func MakeEdge(vertical v: CGFloat, horizontal h: CGFloat) -> UIEdgeInsets {
    return UIEdgeInsets(top: v, left: h, bottom: v, right: h)
}

public extension CGRect {
    var x: CGFloat {
        get { self.minX }
        set { self.origin.x = newValue }
    }

    var y: CGFloat {
        get { self.minY }
        set { self.origin.y = newValue }
    }

    var width: CGFloat {
        get { self.size.width }
        set { self.size.width = newValue }
    }

    var height: CGFloat {
        get { self.size.height }
        set { self.size.height = newValue }
    }
}

extension Int {
    var size: CGSize {
        CGSizeMake(CGFloat(self), CGFloat(self))
    }
}

extension CGFloat {
    var size: CGSize {
        CGSizeMake(CGFloat(self), CGFloat(self))
    }
}

extension Double {
    var size: CGSize {
        CGSizeMake(CGFloat(self), CGFloat(self))
    }
}
